Skip to content

User Defined Action Instance Concurrency Limits #5287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 4, 2023

Conversation

bdoyle0182
Copy link
Contributor

@bdoyle0182 bdoyle0182 commented Jul 20, 2022

Description

Gives users the ability to configure action concurrency limits on their action with respect to their namespace concurrency limit. This finally allows users to be able to configure some level of fairness within their namespace. See POEM 4 for considerations and design.

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Scheduler
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@bdoyle0182 bdoyle0182 changed the title User Defined User Defined Action Concurrency Limits Jul 20, 2022
@bdoyle0182 bdoyle0182 requested review from style95 July 20, 2022 20:33
@bdoyle0182 bdoyle0182 changed the title User Defined Action Concurrency Limits User Defined Action Container Concurrency Limits Feb 10, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2023

Codecov Report

Merging #5287 (4ecec41) into master (f0e281e) will increase coverage by 0.05%.
The diff coverage is 84.49%.

❗ Current head 4ecec41 differs from pull request most recent head 4af16af. Consider uploading reports for the commit 4af16af to get more accurate results

@@            Coverage Diff             @@
##           master    #5287      +/-   ##
==========================================
+ Coverage   76.50%   76.56%   +0.05%     
==========================================
  Files         240      241       +1     
  Lines       14569    14625      +56     
  Branches      647      628      -19     
==========================================
+ Hits        11146    11197      +51     
- Misses       3423     3428       +5     
Impacted Files Coverage Δ
...che/openwhisk/core/loadBalancer/LeanBalancer.scala 0.00% <0.00%> (ø)
...he/openwhisk/core/invoker/FPCInvokerReactive.scala 0.00% <ø> (ø)
...pache/openwhisk/core/invoker/InvokerReactive.scala 71.53% <ø> (+17.69%) ⬆️
...cala/org/apache/openwhisk/http/ErrorResponse.scala 89.09% <50.00%> (-0.73%) ⬇️
...e/openwhisk/core/scheduler/queue/MemoryQueue.scala 80.84% <63.15%> (-1.27%) ⬇️
...in/scala/org/apache/openwhisk/common/Logging.scala 78.05% <66.66%> (-1.33%) ⬇️
...la/org/apache/openwhisk/core/entity/Identity.scala 82.66% <71.42%> (ø)
...enwhisk/core/entity/InstanceConcurrencyLimit.scala 75.00% <75.00%> (ø)
...org/apache/openwhisk/core/controller/Actions.scala 93.75% <96.42%> (-0.17%) ⬇️
...enwhisk/core/entity/FullyQualifiedEntityName.scala 92.10% <100.00%> (+0.21%) ⬆️
... and 6 more

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bdoyle0182
Copy link
Contributor Author

I still can't decide on naming this action config containerConcurrency or instanceConcurrency. Instance is a little more generic towards whatever the future may hold for virtualization terminology so now I find myself leaning towards that, though the current terminology is probably more self explanatory.

val actionLimit = actionMetaData.limits.containerConcurrency
.map(limit =>
if (limit.maxConcurrentContainers > namespaceLimit) ContainerConcurrencyLimit(namespaceLimit) else limit)
.getOrElse(ContainerConcurrencyLimit(namespaceLimit))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ContainerConcurrencyLimit reminds me of intra-container concurrency.
Can we use ActionConcurrency instead? I think we need to consider changing the existing ActionConcurrency to something else like IntraConcurrency to make it more intuitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but that's going to be a breaking change for the existing users of it. Is there a way we could add another new field that maps to the same field stored in the db? I guess I just don't want to have to change the api.

I could rename it to ActionInstanceLimit? And rename the existing Limit case class to ActionIntraConcurrencyLimit.

However the api would have to remain the same such that the two fields the user supplies on the api would be

concurrency
instanceConcurrency

or I could add a third field to the api such that there's these field options on the action put

concurrency
intraConcurrency
instanceConcurrency

where if both intraConcurrency and concurrency are defined, concurrency is ignored and intraConcurrency takes precedence as the value that's used in the service. I could make it such that if you try to upload with both fields the api rejects, and any new uploads of actions with either field defined writes to intraConcurrency in the db and removes concurrency from the document if it exists.

thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that sounds good to me.
So we can support both concurrency and intraConcurrency for a while and finally remove concurrency from API at some point.
The instanceConcurrency is a newly added field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I will get to cleaning up and renaming. Will let you know when I'm ready for another look

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdoyle0182 Thank you so much.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@style95 so I went a little different. I changed the api fields and db fields to be:

concurrency
instances

I think this is sufficient in distinguishing the two mechanisms and they follow the same kind of verbiage for the api fields and keeps us from having to go through a whole api change process which I think can be avoided. I updated the code and documentation to refer to concurrency as intra concurrency including the swagger as well as the additions of this mr to InstanceConcurrency in code.

The concurrency and instances field go into the limits section of the actions document / api so it should be self explanatory that they represent a max and is explained in the documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be better 👍

Copy link
Member

@style95 style95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks generally good to me with one comment.

@bdoyle0182 bdoyle0182 changed the title User Defined Action Container Concurrency Limits User Defined Action Instance Concurrency Limits Feb 17, 2023
Copy link
Member

@style95 style95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bdoyle0182 bdoyle0182 closed this Mar 28, 2023
@bdoyle0182 bdoyle0182 reopened this Mar 28, 2023
@bdoyle0182 bdoyle0182 merged commit 72bb2a1 into apache:master May 4, 2023
mtt-merz pushed a commit to mtt-merz/openwhisk that referenced this pull request Oct 22, 2023
* working prototype

* consider when to turn on namespace throttling

* tests and final cleanup

* update swagger

* fix container concurrency field

* fix tests

* renaming

* update docs

* more cleanup

---------

Co-authored-by: Brendan Doyle <[email protected]>
(cherry picked from commit 72bb2a1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants